<p class="entity-table">
    <?= $this->Html->link("&laquo; nazad", "/payments", array( 'escape' => false ))?>
    
    <span class="actions visible form button-set">
    <? if (!empty($data['Payment']['id'])): ?>
    <? $entityId = $data['Payment']['id'] ?>
    
        <?= $this->Form->button('Obriši', array(
            'class'   => 'delete',
            'onclick' => "if (confirm('Da li želite da obrišete uplatu?')){location.href = '/payments/remove/{$entityId}'}"
        ))?>
    <? endif ?>
    </span>
</p>
<?= $this->Form->create('Payment', array('url' => '/payments/save')) ?>

    <?= $this->Form->hidden('id', array( 'value' => (int)@$data['Payment']['id'])) ?>
    
    <p><?= $this->Form->label('campaign_id', 'Kampanja:') ?>
    <?= $this->App->autocomplete('campaign_id', array(
        'label'  => @$data['Campaign']['label'],
        'value'  => @$data['Campaign']['id'],
        'url' => '/campaigns/search'
    )) ?><?= $this->App->formError('campaign_id') ?></p>
    
    <p><?= $this->Form->label('invoice_id', 'Faktura:') ?>
    <?= $this->App->autocomplete('invoice_id', array(
        'label'  => @$data['Invoice']['number'],
        'value'  => @$data['Invoice']['id'],
        'url' => '/invoices/search'
    )) ?><?= $this->App->formError('invoice_id') ?></p>
    
    <p><?= $this->Form->label('date', 'Datum:') ?>
    <?= $this->Form->text('date', array(
        'value' => @$data['Payment']['date'],
        'class' => 'datepicker',
        'required' => false
    ))?><?= $this->App->formError('date') ?></p>
    
    <p><?= $this->Form->label('amount', 'Iznos:') ?>
    <?= $this->Form->text('amount', array(
        'value' => @$data['Payment']['amount'],
        'class' => 'price'
    ))?><?= CURRENCY_SYM ?><?= $this->App->formError('amount') ?></p>
    
    <p><?= $this->Form->label('comment', 'Napomena:', array('class'=>'left')) ?>
    <?= $this->Form->textarea('comment', array(
        'value' => @$data['Payment']['comment']
    ))?></p>

    <?= $this->Form->button('Sačuvaj') ?>
<?= $this->Form->end() ?>
